year2=80:2:96;
year1=80:1:96;

num_banks_comm=[323,	331,	344,	346,	350, 376, 406,433,474,491,510,587,667,709,742,788,837];
credit_access_ratio=[8.75  9.1, 9.2, 10.5,15,19,22,24,26];

[X1,Y1,a1,b1]=get_line(year1,num_banks_comm,1:1:7);
[X2,Y2,a2,b2]=get_line(year1,num_banks_comm,7:1:17);
[X3,Y3,a3,b3]=get_line(year2,credit_access_ratio,1:1:4);
[X4,Y4,a4,b4]=get_line(year2,credit_access_ratio,4:1:9);

fig=figure('color', [1 1 1 ], 'Position',[200 20 800 320]);

handle=subplot(1,2,1);
plot(year1, num_banks_comm, '-b' , 'LineWidth', 2 );
hold on
plot([X1(:,2);92], [Y1;a1+b1*92], '--r' , 'LineWidth', 1 );
plot(X2(:,2), Y2, '-.k' , 'LineWidth', 1 );
title( 'A. No. of markets with branches', 'FontSize',15,'Interpreter','Latex');
xlabel('year', 'FontSize',12,'Interpreter','Latex');
ylabel('no. of markets with branches', 'FontSize',12,'Interpreter','Latex');
xlim([80,96]);
xticks([80:2:96]);
set(gca,'FontSize',12);
[x,y]=normalize([0.335,0.3275],[0.2475,0.319],0.07);
annotation('arrow',x,y, 'LineStyle','-.','color',[0 0 0], 'Headstyle', 'vback2', 'HeadWidth', 3);
text(88, 360, 'before 86','color',[0 0 0], 'FontSize',10,'Interpreter','Latex');
[x,y]=normalize([0.317,0.3405],[0.535,0.4863],0.06);
annotation('arrow',x,y, 'LineStyle','-.','color',[0 0 0], 'Headstyle', 'vback2', 'HeadWidth', 3);
text(87, 625, 'after 86','color',[0 0 0], 'FontSize',10,'Interpreter','Latex');


% set(gca,'XTick',[1981 1986 1991 1996]);

subplot(1,2,2);
plot(year2, credit_access_ratio, '-b' , 'LineWidth', 2 );
hold on
plot([X3(:,2);92], [Y3;a3+b3*92], '--r' , 'LineWidth', 1 );
plot(X4(:,2), Y4, '-.k' , 'LineWidth', 1 );
title( 'B. Entrepreneurs with bank loans', 'FontSize',15,'Interpreter','Latex');
xlabel('year', 'FontSize',12,'Interpreter','Latex');
ylabel('entrepreneurs with bank loans (\%)', 'FontSize',12,'Interpreter','Latex');
xlim([80,96]);
xticks([80:2:96]);
ylim([8,30]);
set(gca,'FontSize',12);
[x,y]=normalize([0.815,0.809],[0.2,0.2765],0.07);
annotation('arrow',x,y, 'LineStyle','-.','color',[0 0 0], 'Headstyle', 'vback2', 'HeadWidth', 3);
text(90, 9, 'before 86','color',[0 0 0], 'FontSize',10,'Interpreter','Latex');
[x,y]=normalize([0.817,0.7955],[0.4813,0.5365],0.06);
annotation('arrow',x,y, 'LineStyle','-.','color',[0 0 0], 'Headstyle', 'vback2', 'HeadWidth', 3);
text(91, 16.5, 'after 86','color',[0 0 0], 'FontSize',10,'Interpreter','Latex');

